<?xml version="1.0" encoding="UTF-8" ?>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Spring MVC</title>
<script type="text/javascript"
	src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript"
	src="http://jquery-json.googlecode.com/files/jquery.json-2.2.min.js"></script>
<script type="text/javascript" src="index.js"></script>

<link rel="stylesheet" type="text/css"
	href="/htdocs/extjs/resources/css/ext-all.css" />
	
<link rel="stylesheet" type="text/css"
	href="/htdocs/desktop/css/desktop.css" />

<script type="text/javascript"
	src="/htdocs/extjs/adapter/ext/ext-base-debug.js"></script>
<script type="text/javascript"
	src="/htdocs/extjs/ext-all-debug.js"></script>


</head>
<body>
<div id="info"></div>
<!--  -->
<form action="add" method="post" id="form">编号：<input type="text"
	name="id" /> 公司名称：<input type="text" name="companyName" /> 地址：<input
	type="text" name="address" /> <input type="button" value="提交"
	id="submit" /></form>
<div id="fr"></div>	
<script type="text/javascript">
Ext.onReady(function(){

    Ext.QuickTips.init();

    var simple = new Ext.FormPanel({
    	applyTo: 'fr',
        labelWidth: 75,
        url:'save-form.php',
        frame:true,
        title: 'Simple Form',
        bodyStyle:'padding:5px 5px 0',
        width: 350,
        defaults: {width: 230},
        defaultType: 'textfield',

        items: [{
            xtype:'hidden',
            name:'id',
			value:0
          },{
                fieldLabel: 'linkMam',
                name: 'linkMam'
            },{
                fieldLabel: 'linkTel',
                name: 'linkTel'
            },{
                fieldLabel: 'Company',
                name: 'companyName'
            }
        ],

        buttons: [{
            text: 'Save',
            handler:submitForm
        },{
            text: '保存2',
            handler:submitForm2
        }]
    });

    function submitForm(){

  		  	Ext.Ajax.request({
       			url:'/admin/com/createPartner.do',
       			method :"post",
				jsonData :Ext.encode(simple.getForm().getValues()),
				waitMsg : '正在提交数据,请稍候...',
      			success:function(response,options){
				
					Ext.MessageBox.alert("提示","操作成功!");
       			},
       			failure:function(response,options){
            		Ext.MessageBox.alert("提示","发生异常，请稍候处理!");    
       			}
   			});
  		}

    function submitForm2(){

    	simple.getForm().submit({
   			url:'/admin/com/createPartner.do',
   			method :"post",
			waitMsg : '正在提交数据,请稍候...',
  			success:function(response,options){
			
				Ext.MessageBox.alert("提示","操作成功!");
   			},
   			failure:function(response,options){
        		Ext.MessageBox.alert("提示","发生异常，请稍候处理!");    
   			}
			});
		}

 });



</script>	
	
</body>
</html>